package com.heima.search.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.search.dtos.HistorySearchDto;
import com.heima.model.search.dtos.UserSearchDto;
import com.heima.search.service.ApUserSearchService;
import com.heima.search.service.impl.ArticleSearchImpl;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@RequestMapping("/api/v1/history")
public class HistorySearchController {
    @Resource
    private ApUserSearchService articleSearch;

    @PostMapping("/load")
    public ResponseResult search(@RequestBody UserSearchDto dto) throws IOException {
        return articleSearch.load();
    }

    @PostMapping("/del")
    public ResponseResult delHistory(@RequestBody HistorySearchDto dto){
        return articleSearch.delHistory(dto);
    }
}